package com.lcm.ribbon.myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.netflix.loadbalancer.RoundRobinRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 切记，自定义的负载均衡规则不能定义在componentScan注解能扫到的包及其子包下
 *
 * @author: Coder-Lcm
 * @date: 2020/10/28 14:15
 */
@Configuration
public class MySelfRule {

    @Bean
    public IRule myRule(){

//        return new RandomRule();  //负载均衡策略定义为： 随机
        return new RoundRobinRule();
    }
}
